package com.design.singleton;

/**
 * @Author: ChengLei.Liu
 * @Date: 2020-06-05 14:44
 * @Description: 单例模式
 *  使用枚举实现 枚举构造方法是私有的  而且 只会执行一次
 */
public enum  Singleton07 {

    INSTANCE;

    Singleton07(){
        System.out.println("Singleton07 初始化了...");
    }

    public static void main(String[] args) {
        Singleton07 singleton1 = Singleton07.INSTANCE;
        Singleton07 singleton2 = Singleton07.INSTANCE;
        System.out.println(singleton1 == singleton2);
    }
}
